<%@ page language="java" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/pub/include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理--<c:choose><c:when test="${empty ads}"></c:when><c:otherwise>编辑广告</c:otherwise></c:choose></title>


<script type="text/javascript">
function trim(str){
	return str.replace(/^\s+|\s+$/,"");
}
function check(form){
//	if(form.menuId.value==0){
//		alert("您还未选择广告");
//		return false;
//	}
	if(trim(form.name.value)==""){
		alert("广告标题不能为空");
		return false;
	}
	if(trim(form.orderSort.value)==""){
        alert("优先级不能为空");
        return false;
    }

    if(trim(form.dictUrl.value)==""){
        alert("跳转地址不能为空");
        return false;
    }
    if(trim(form.startTime.value)==""){
        alert("开始时间不能为空");
        return false;
    }
    if(trim(form.endTime.value)==""){
        alert("结束时间不能为空");
        return false;
    }
    if(trim(form.img.value)==""){
        alert("封面图不能为空");
        return false;
    }
    if($("#enable").attr("checked")==true)
    {
        form.enable.value=true;
    } else{
        form.enable.value=false;
    }

	<c:if test="${not empty ads}">
		form.action="<c:url value="/ads/adsadd?m=doedit"/>";
	</c:if>
	return true;
}
</script>
</head>
<body>
<div class="content">
<jsp:include page="../pub/top.jsp"></jsp:include>
<!--头部结束-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="left" valign="top">
<jsp:include page="../pub/left_ads.jsp"></jsp:include>
</td>
<td valign="top">
	<div class="right">
	<form action="<c:url value="/ads/adsadd?m=dopub"/>" method="post" onsubmit="return check(this)" enctype="multipart/form-data" style="margin:0">
	<table width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#d1d5d8">
	<tr>
	<td height="28" colspan="2" bgcolor="#c6dbf8" class="biaoti" style="padding:0;">
	<c:choose>
		<c:when test="${empty ads}">广告发布</c:when>
		<c:otherwise>广告编辑</c:otherwise>
	</c:choose>
	</td>
	</tr>
	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>标题：</td>
	<td height="28" bgcolor="#FFFFFF"><input type="text" name="name" id="name" value="${ads.name}" maxlength="25"/><p>广告标题</p></td>
	</tr>
	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>优先级：</td>
	<td height="28" bgcolor="#FFFFFF"><input type="number" name="ordersort" id="ordersort" min="1" max="5" value="<c:out value="${ads == null ?   1 : ads.ordersort}"/>"/><p>请输入优先级</p></td>
	</tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>跳转：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" name="dictUrl" id="dictUrl" value="${ads.dictUrl}" maxlength="25"/><p>跳转H5链接地址</p></td>
        </tr>
	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7">是否开启：</td>
	<td height="28" bgcolor="#FFFFFF"><input type="checkbox" name="enable"  id="enable" checked="checked"  value="${ads.enable}" /><p></p></td>
	</tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开始时间：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" id="startTime" name="startTime" value="${ads.startTime}" maxlength="20" placeholder="请选择"  readonly/><p><input type="button" onClick="jeDate({dateCell:'#startTime',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" value="选择时间"></p></td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>结束时间：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" id="endTime" name="endTime" value="${ads.endTime}" maxlength="20" placeholder="请选择"  readonly/><p><input type="button" onClick="jeDate({dateCell:'#endTime',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" value="选择时间"></p></td>
        </tr>
	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>封面图片：</td>
	<td height="28" bgcolor="#FFFFFF">
		<input type="file" name="img" id="img"/>
		<p>请上传封面图片</p></td>
	</tr>

	<%--<tr>--%>
	<%--<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>新闻内容：</td>--%>
	<%--<td height="28" bgcolor="#FFFFFF">--%>
		<%--<textarea name="content"><c:out value="${newsEntity.content}" escapeXml="false"/></textarea>--%>
		<%--<p>请输入新闻内容</p></td>--%>
	<%--</tr>--%>
	</table>
	<div class="anniu">
	<p><input type="submit" value="提交" class="fabu" /> <input type="reset" value="重置" class="fabu" /></p>
	<input type="hidden" name="id" value="${ads.id}"/>
	</div>
	</form>
	</div>
	<br />
	<br />
</td>
</tr>
</table>
<jsp:include page="../pub/foot.jsp"></jsp:include>
</div>
<%--<script type="text/javascript" src="<%=request.getContextPath() %>/fckeditor/fckeditor.js"></script>--%>
<%--<script type="text/javascript">--%>
<%--var oFCKeditor = new FCKeditor('content') ;--%>
<%--oFCKeditor.BasePath	= "${pageContext.request.contextPath}/fckeditor/";--%>
<%--oFCKeditor.Width="710";--%>
<%--oFCKeditor.Height="340";--%>
<%--oFCKeditor.Value="&nbsp;&nbsp;&nbsp;&nbsp;";--%>
<%--oFCKeditor.ToolbarSet="classnet";--%>
<%--oFCKeditor.Config["CustomConfigurationsPath"]="${pageContext.request.contextPath}/fckeditor/myconfig.js?d="+new Date().getTime();--%>
<%--oFCKeditor.ReplaceTextarea();--%>
<%--</script>--%>
</body>
</html>
